import Vue from 'vue'
import Router from 'vue-router'

import Home from 'components/home/home'
// import Index from 'components/index/index'
// import pageContent from 'components/pageContent/pageContent'
// import gameManage from 'components/gameManage/gameManage'
// import gameGift from 'components/gameGift/gameGift'
// import source from 'components/source/source'
// import system from 'components/system/system'

import Login from 'components/login/login'
import profit from 'components/profit/profit'
import accountRank from 'components/accountRank/accountRank'
import channelRank from 'components/channelRank/channelRank'
import rankDetail from 'components/detail/rankDetail'
import agentDetail from 'components/detail/agentDetail'
import newGame from 'components/newGame/newGame'
import page404 from 'components/errorPage/404'

Vue.use(Router)

// export default new Router({
//   mode: 'history',
//   routes: [
//     {
//       path: '/',
//       name: 'Home',
//       component: Home,
//       redirect:'/profit',
//       children:[
//        {
//         path:'/profit',
//         name: 'profit',
//         component: profit,
//         meta:{
//           title:'B游汇平台利润'
//         }
//        },
//        {
//         path:'/accountRank',
//         name: 'accountRank',
//         component: accountRank,
//         meta:{
//           title:'帐号充值排行榜'
//         }
//        },
//        {
//         path:'/channelRank',
//         name: 'channelRank',
//         component: channelRank,
//         meta:{
//           title:'渠道充值排行榜'
//         }
//        },
//        {
//         path:'/rankDetail/:name',
//         name: 'rankDetail',
//         component: rankDetail,
//         meta:{
//           title:'账号充值排行榜详情'
//         } 
//        },
//        {
//         path:'/agentDetail/:name/:time?',
//         name: 'agentDetail',
//         component: agentDetail,
//         meta:{
//           title:'渠道充值排行榜详情'
//         } 
//        }
//       ]
//     },
//     {
//       path:'/login',
//       name: 'login',
//       component: Login,
//     }
//   ]
// })

export const constantRouterMap = [
  {
    path: '/login',
    component: Login,
  },
  {
    path:'*',
    component:page404
  },
  {
    path:'/',
    redirect:'/accountRank'
  },
  {
    path:'/home',
    component:Home,
    children:[
      {
        path:'/accountRank',
        name: 'accountRank',
        component: accountRank,
        meta:{
          title:'帐号充值排行榜'
        }
      },
      {
        path:'/channelRank',
        name: 'channelRank',
        component: channelRank,
        meta:{
          title:'渠道充值排行榜'
        }
      },
      {
        path:'/rankDetail/:name',
        name: 'rankDetail',
        component: rankDetail,
        meta:{
          title:'账号充值排行榜详情'
        } 
       },
      {
        path:'/agentDetail/:name/:time?',
        name: 'agentDetail',
        component: agentDetail,
        meta:{
          title:'渠道充值排行榜详情'
        } 
      },
      {
        path:'/newGame',
        name: 'newGame',
        component: newGame,
        meta:{
          title:'新游数据展示'
        } 
      }
    ]
  }
]

export const asyncRouterMap =[
  {
    path:'/home',
    component:Home,
    children:[
      {
        path:'/profit',
        name: 'profit',
        component: profit,
        meta:{
          title:'B游汇平台利润',
          roles: ['admin'] 
        }  
      }
    ]
  }
]
export default new Router({
  mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})